//
// ********************************************************************
// * License and Disclaimer                                           *
// *                                                                  *
// * The  Geant4 software  is  copyright of the Copyright Holders  of *
// * the Geant4 Collaboration.  It is provided  under  the terms  and *
// * conditions of the Geant4 Software License,  included in the file *
// * LICENSE and available at  http://cern.ch/geant4/license .  These *
// * include a list of copyright holders.                             *
// *                                                                  *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work  make  any representation or  warranty, express or implied, *
// * regarding  this  software system or assume any liability for its *
// * use.  Please see the license in the file  LICENSE  and URL above *
// * for the full disclaimer and the limitation of liability.         *
// *                                                                  *
// * This  code  implementation is the result of  the  scientific and *
// * technical work of the GEANT4 collaboration.                      *
// * By using,  copying,  modifying or  distributing the software (or *
// * any work based  on the software)  you  agree  to acknowledge its *
// * use  in  resulting  scientific  publications,  and indicate your *
// * acceptance of all terms of the Geant4 Software license.          *
// ********************************************************************

#ifndef DetectorConstruction_h
#define DetectorConstruction_h 1

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

#include "G4Material.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VUserDetectorConstruction.hh"

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

class DetectorMessenger;
class G4LogicalVolume;

class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
    /// world phantom 默认尺寸
    DetectorConstruction();
    virtual ~DetectorConstruction();

    G4VPhysicalVolume* Construct();

    void SetNewMaterial(const G4String& m);

    inline G4double GetGeneratorPosZ() const { return _fGeneratorPosZ; };
    inline void SetPhantomZ(G4double val) { _fPhantomZ = val; }
    inline void SetPhantomXY(G4double val) { _fPhantomXY = val; }  //2022.10.18
    inline void SetFactor(G4double val) { _fFactor = val; }        //2022.10.18

    G4double GetPhantomZ() const { return _fPhantomZ; }

    void SetVerbose(G4bool v) { _fVerbose = v; }
    inline G4bool GetVerbose() const { return _fVerbose; }

    void DumpGeometryParameters();

    const G4VPhysicalVolume* GetPhantom() const { return _fPhantom; }
    G4double GetPhantomXY() const { return _fPhantomXY; }

private:
    /// 根据用户输入, 计算 world, phantom 尺寸
    void InitialiseGeometryParameters();

    DetectorConstruction& operator=(const DetectorConstruction& right);
    DetectorConstruction(const DetectorConstruction&);

    G4bool _fVerbose;

    G4double _fWorldXY, _fWorldZ;
    G4double _fPhantomXY, _fPhantomZ;
    G4double _fPhantomShiftZ;
    G4double _fGeneratorPosZ;

    G4LogicalVolume* _fLogicPhantom;
    G4VPhysicalVolume* _fPhantom;

    G4Material* _fWorldMaterial;
    G4Material* _fAbsorberMaterial;

    DetectorMessenger* _fMessenger;

    G4double _fFactor;  //2022.10.18
};

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

#endif
